from fastapi import Request, Response
from fastapi.routing import APIRoute
from afast_core.core_libs.classy_apirouter.group_router import RestInjectForAPIRouter, RestInjectForDocRouter
from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from afast_core.core_libs.classy_apirouter import IHookGroupBaseController
from afast_core.core_libs.classy_apirouter import get, post
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.bdor_list_all_value_list import \
    InfirmaryDoctorStationNameListValueListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.doctor_station_rule_info import \
    DoctorStationRuleInfoController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.doctor_station_rule_info_addnewuser import \
    DoctorStationRuleInfoAddNewUserController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.doctor_station_rule_info_updata import \
    DoctorStationRuleInfoUpdateController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_all import \
    InfirmaryBusinessesQuestListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_all_value_list import \
    InfirmaryBusinessesQuestListValueListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_add import \
    InfirmaryBusinessesAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_del import \
    InfirmaryBusinessesDelController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_doctor_all import \
    InfirmaryBusinessesDoctorQuestListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_doctor_scheduling_all import \
    InfirmaryBusinessesDoctorSchedulingQuestListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_doctor_scheduling_order_all import \
    InfirmaryBusinessesDoctorSchedulingOrderQuestListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_doctor_scheduling_order_dowload_all import \
    InfirmaryBusinessesDoctorSchedulingOrderQuestDownloadListController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_b_update import \
    InfirmaryBusinessesUpdateController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_add import \
    InfirmaryBusinessesDoctorUserAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_del import \
    InfirmaryBusinessesDoctorUserDelController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_interim_scheduling_add import \
    InfirmaryBusinessesDoctorInterimSchedulingController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_scheduling_batch_del import \
    InfirmaryBusinessesDoctorUserSchedulingBatchDelController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_scheduling_del import \
    InfirmaryBusinessesDoctorUserSchedulingDelController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bdor_update import \
    InfirmaryBusinessesDoctorUserUpdateController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bs_add import \
    InfirmaryBusinessesStationAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bs_del import \
    InfirmaryBusinessesStationDelController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_bs_update import \
    InfirmaryBusinessesStationUpdateController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.controllers.list_station_all import \
    InfirmaryBusinessesStationQuestListController


#  tags=['测试类装饰器依赖项']

@RestInjectForAPIRouter(prefix='/infirmary/businesses')
@RestInjectForDocRouter(tags=['后台系统-医馆管理--列表'])
class AGroupAPIRouterBuilder(IHookGroupBaseController):

    async def before_request(self, curr_apiroute: APIRoute, request: Request) -> None:
        """如果需要修改请求信息，可直接重写此方法"""
        pass
        request.state.api_router_builder = self
        # 如果存在body对象的，在这里读取一下，以备后续的使用
        request.state.schema_param_body = await request.body()
        print("request.state.schema_param_body ", request.state.schema_param_body)

    async def after_request(self, request: Request, response: Response) -> None:
        """请求后的处理"""
        pass

    @get("/query/list", summary='获取当前医馆列表信息')
    def admin_businesses_list_all(self, controller: IBaseController = InfirmaryBusinessesQuestListController):
        return controller.sync_response()

    @get("/query/list/valueList", summary='获取当前系统所有医馆的列表信息，仅仅获取名称和APPID')
    def admin_businesses_list_valueList_all(self,
                                            controller: IBaseController = InfirmaryBusinessesQuestListValueListController):
        return controller.sync_response()

    @post("/update", summary='医馆信息更新')
    def admin_businesses_list_update(self, controller: IBaseController = InfirmaryBusinessesUpdateController):
        return controller.sync_response()

    @post("/add", summary='医馆信息添加')
    def admin_businesses_list_add(self, controller: IBaseController = InfirmaryBusinessesAddController):
        return controller.sync_response()

    @get("/delete/{id}", summary='医馆信息的删除')
    def admin_businesses_list_item_del(self, controller: IBaseController = InfirmaryBusinessesDelController):
        return controller.sync_response()

    @post("/station/update", summary='医馆驻点医馆信息信息更新')
    def admin_businesses_station_update(self, controller: IBaseController = InfirmaryBusinessesStationUpdateController):
        return controller.sync_response()

    @post("/station/add", summary='医馆驻点医馆信息添加')
    def admin_businesses_station_add(self, controller: IBaseController = InfirmaryBusinessesStationAddController):
        return controller.sync_response()

    @get("/station/delete/{id}", summary='医馆信息的删除')
    def admin_businesses_list_station_item_del(self,
                                               controller: IBaseController = InfirmaryBusinessesStationDelController):
        return controller.sync_response()

    @get("/station/query/list", summary='获取当前医馆列表信息')
    def admin_businesses_station_list_all(self,
                                          controller: IBaseController = InfirmaryBusinessesStationQuestListController):
        return controller.sync_response()

    @get("/doctor/query/list", summary='获取当前所有医生列表信息')
    def admin_businesses_doctor_query_list_all(self,
                                               controller: IBaseController = InfirmaryBusinessesDoctorQuestListController):
        return controller.sync_response()

    @get("/doctor/station/rule/info", summary='获取当前所有医生列表信息')
    def admin_businesses_doctor_station_rule_info(self, controller: IBaseController = DoctorStationRuleInfoController):
        return controller.sync_response()

    @post("/doctor/station/rule/info/update", summary='医生规则更新')
    def admin_businesses_doctor_station_rule_info_update(self,
                                                         controller: IBaseController = DoctorStationRuleInfoUpdateController):
        return controller.sync_response()

    @post("/doctor/station/rule/info/addnewuser", summary='医生新的规则配置并应用')
    def admin_businesses_doctor_station_rule_info_addnewuser(self,
                                                             controller: IBaseController = DoctorStationRuleInfoAddNewUserController):
        return controller.sync_response()

    @post("/doctor/user/update", summary='医生用户信息的更新')
    def admin_businesses_doctor_user_update(self,
                                            controller: IBaseController = InfirmaryBusinessesDoctorUserUpdateController):
        return controller.sync_response()

    @post("/doctor/user/add", summary='添加医生信息')
    def admin_businesses_doctor_user_add(self,
                                         controller: IBaseController = InfirmaryBusinessesDoctorUserAddController):
        return controller.sync_response()

    @get("/doctor/user/delete/{id}", summary='医生信息删除')
    def admin_businesses_doctor_user_delete(self,
                                            controller: IBaseController = InfirmaryBusinessesDoctorUserDelController):
        return controller.sync_response()

    @get("/doctor/scheduling/query/list", summary='获取当前医生所属医馆的排班的列表信息')
    def admin_businesses_doctor_scheduling_query_list_all(self,
                                                          controller: IBaseController = InfirmaryBusinessesDoctorSchedulingQuestListController):
        return controller.sync_response()

    @get("/query/doctor/user/scheduling/list/valueList", summary='获取当前某个医馆驻点列表')
    def admin_businesses_doctor_user_scheduling_list_valueList_all(self,
                                                                   controller: IBaseController = InfirmaryDoctorStationNameListValueListController):
        return controller.sync_response()

    @get("/doctor/user/scheduling/delete/{id}", summary='根据ID删除相关的医生的排班记录')
    def admin_businesses_doctor_user_scheduling_delete_byid(self,
                                                            controller: IBaseController = InfirmaryBusinessesDoctorUserSchedulingDelController):
        return controller.sync_response()

    @post("/doctor/user/scheduling/delete/batch", summary='批量的删除医生的排班信息')
    def admin_businesses_doctor_user_scheduling_delete_batch_byid(self,
                                                            controller: IBaseController = InfirmaryBusinessesDoctorUserSchedulingBatchDelController):
        return controller.sync_response()

    @post("/doctor/interim/scheduling/info/add", summary='医生临时排班添加处理')
    def admin_businesses_doctor_interim_scheduling_info_add(self,
                                                            controller: IBaseController = InfirmaryBusinessesDoctorInterimSchedulingController):
        return controller.sync_response()


    @get("/doctor/scheduling/order/query/list", summary='获取医生订单详情信息')
    def admin_businesses_doctor_user_scheduling_order_query_list(self,
                                                                   controller: IBaseController = InfirmaryBusinessesDoctorSchedulingOrderQuestListController):
        return controller.sync_response()

    # doctor/scheduling/order/query/list?appid=ZSZ10&dc_number=ZSZ1010010&pageNum=1&pageSize=10

    @get("/doctor/scheduling/order/query/download/list", summary='导出医生表格数据信息')
    def admin_businesses_doctor_user_scheduling_order_query_download_list(self,
                                                                 controller: IBaseController = InfirmaryBusinessesDoctorSchedulingOrderQuestDownloadListController):
        return controller.sync_response()
